package com.csusm.geo.science.tutor;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class TutorService extends Service{

	NotificationManager mNotificationManager;
	
	@SuppressWarnings("static-access")
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		mNotificationManager = (NotificationManager) getSystemService(this.NOTIFICATION_SERVICE);
		Notification notification = new Notification(R.drawable.stat_notify_chat, "Geo Science Tutor", 
														System.currentTimeMillis());
		Intent nIntent = new Intent(this, GeoScienceTutorAppActivity.class);
		PendingIntent pIntent = PendingIntent.getActivity(this, 0, nIntent, 0);

		notification.setLatestEventInfo(this, "Alert", "You are in two miles radius of Geo Location", pIntent);
		notification.defaults = Notification.DEFAULT_ALL;
//		mNotificationManager.notify( 12325, notification);
		startForeground(1337, notification);
		return(START_NOT_STICKY);
	}
	
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}

	@Override
	public void onDestroy() {
	      stopForeground(true);
	}

}
